<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>求表单里的平均值和最大值</title>
    <script type="text/javascript">
        function mean(first,second,third) {
            result = (parseInt(first.value) + parseInt(second.value) + parseInt(third.value)) / 3;
            alert("平均值："+result);
        }
        function max(first,second,third) {
            var max = first.value
            if (second.value>max){
                max = second.value
            }
            if (third.value > max){
                max = third.value
            }
            alert("最大值："+max)
        }
    </script>
</head>
<body>
    <form action="">
        第一个值：<input type="text" name="first" size="2">
        第二个值：<input type="text" name="second" size="2">
        第三个值：<input type="text" name="third" size="2"><br><br>
        <button type="button" onclick="mean(first,second,third)">平均值</button>
        <button type="button" onclick="max(first,second,third)">最大值</button>
    </form>
</body>
</html>